package org.dgt.model.core;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.NamedQueries;
import org.hibernate.annotations.NamedQuery;

@Entity
@Table(name = "PRODUCT")
public class Product extends Base {

	@Column(name = "PRODUCT_NAME", nullable = false)
	private String name;
	
	@OneToMany
	@JoinTable(name = "PRODUCT_IMAGE", 
				joinColumns = @JoinColumn(name = "PRODUCT_ID"), 
				inverseJoinColumns = @JoinColumn(name = "IMAGE_ID"))	
	private List<Image> images;

	@Column(name = "BRAND_NEW")
	private boolean brandNewOrOld;
	
	@Column(name = "HOW_OLD", precision = 2)
	private float howOld;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public List<Image> getImages() {
		return images;
	}

	public void setImages(List<Image> images) {
		this.images = images;
	}

	public boolean isBrandNewOrOld() {
		return brandNewOrOld;
	}

	public void setBrandNewOrOld(boolean brandNewOrOld) {
		this.brandNewOrOld = brandNewOrOld;
	}

	public float getHowOld() {
		return howOld;
	}

	public void setHowOld(float howOld) {
		this.howOld = howOld;
	}

}
